import amesu from "../model/bot/amesu";
import browser, { tempDir } from "../model/browser/browser";
import func from "../model/func";
import { MsgAction, Tpl_attribute } from "../shared/master/MsgAction";
import { style_default } from "../style/default";
export default function (data: MsgAction) {
    let t = data.data as Tpl_attribute;
    func.roundNumbers(t);
    let att = t.attributes;

    switch (t.render_type) {
        case 'player_concise':

            browser.render(tempDir.属性模板, {
                userName: t.name,
                att: func.roundNumBn(att),
                t: func.roundNumBn(t),
                dna_name: t.dna_name,
                job_name: t.job_name,
                Talent_name: t.Talent_name,
                hp_bar: `${Math.ceil((t.hp_now / att.Hp_Max) * 100)}%`,
                mp_bar: `${Math.ceil((t.mp_now / att.Mp_Max) * 100)}%`,
                style_body: t.style_id,
                style_title: t.title_style,
                score: t.score,
                team_name: t.team_name
            }).then((png) => {
                amesu.sendLocaImage(data.tolocation, png);
            });
            break;

        default:
            func.roundNumBn(t)
            func.roundNumBn(att)
            let tpl = new style_default();
            tpl.addLine('属性页面');
            tpl.addLine(`名称${t.name}`)
            tpl.addLine(`综合评分:${t.score}`)
            tpl.addLine(`等级:Lv. ${t.leve.num}(${t.leve.now}/${t.leve.max})`)
            tpl.addLine(`天赋:${t.Talent_name}`)
            tpl.addLine(`血统:${t.job_name}`)
            tpl.addLine(`基因锁:${t.dna_name}`)
            tpl.addLine(`力量:${t.Points.a}`)
            tpl.addLine(`敏捷:${t.Points.b}`)
            tpl.addLine(`精神:${t.Points.c}`)
            tpl.addLine(`幸运:${t.Points.d}`)
            tpl.addLine(`召唤数量:${att.Calls_cont}`)
            tpl.addLine(`召唤等级最高:${att.Calls_leveMax}`)
            tpl.addLine(`召唤等级最低:${att.Calls_leveMin}`)
            tpl.addLine(`召唤评分:${att.Calls_sore}`)
            tpl.addLine(`生命值:${t.hp_now}/${att.Hp_Max}(${att.Hp_res}/s)`)
            tpl.addLine(`魔法值:${t.mp_now}/${att.Mp_Max}(${att.Mp_res}/s)`)
            tpl.addLine(`物攻:${att.Physical_Attack_min}-${att.Physical_Attack_max}`)
            tpl.addLine(`物防:${att.Physical_defense}`)
            tpl.addLine(`物理吸血:${att.Physical_Ls}`)
            tpl.addLine(`物理暴击率:${att.Physical_crit}`)
            tpl.addLine(`攻击速度:${att.Attack_Speed}`)
            tpl.addLine(`魔攻:${att.Magic_Attack_min}-${att.Magic_Attack_max}`)
            tpl.addLine(`魔防:${att.Magic_defense}`)
            tpl.addLine(`法术吸血:${att.Magic_Ls}`)
            tpl.addLine(`法术暴击率:${att.Magic_crit}`)
            amesu.sendText(data.tolocation, tpl.end())
            break;
    }


}